#!/usr/bin/python
# -*- coding: utf-8 -*-


from django.shortcuts import render_to_response
from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
from django.utils import simplejson

    

def get_monitor_usb(request):
    if request.is_ajax():
        message ={"html":"<i>Данные в сети XBEE</i><br>"}
    else:
        message ={"html":{"html":"fff"}}
    return HttpResponse(simplejson.dumps(message), mimetype='application/json')

def get_monitor_wifi(request):
    if request.is_ajax():
        message ={"html":"<i>Данные сокета</i><br>"}
    else:
        message ={"html":{"html":"fff"}}
    return HttpResponse(simplejson.dumps(message), mimetype='application/json')



def view_monitor(request):

    from sockets.models import Socket
    from dapi.models import Var 
    default_refresh_interval=Var.objects.get(name="default_refresh_interval").value
    all_sockets=Socket.objects.all()
    ws=all_sockets.filter(type='N')
    ss=all_sockets.filter(type='S')
    return render_to_response('base.html', locals())
